#import "ALCustomEventFilterController.h"


#pragma mark -
@implementation ALCustomEventFilterController

@synthesize entriesArrayController;


-(void)awakeFromNib {
    [super awakeFromNib];
    [[self entriesArrayController] setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:ALLabelKey ascending:YES]]];
}

-(NSIndexSet *)tableView:(NSTableView *)tableView selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes {
    if ([proposedSelectionIndexes count] == 0)
        return [tableView selectedRowIndexes];
    return proposedSelectionIndexes;
}

-(void)tableViewSelectionDidChange:(NSNotification *)aNotification {
    NSArray *selectedObjects = [[self entriesArrayController] selectedObjects];
    [[NSNotificationCenter defaultCenter] postNotificationName:ALCustomEntryFilterDidChangeNotification object:selectedObjects];
}

@end
